<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<script src="/js/jquery.form.js" type="text/javascript"></script>


	<div class="release_title else_font">
		<a href="javascript:void(0);"  class="tc_close close_btn">关闭</a>
		<p>选择你要上传的图片（支持GIF/JPG/PNG，最大4M）</p>
	</div>
		<form class="picUploadForm" id="upload_img_form" action="uploadCommentImg.htm" method="POST" enctype="multipart/form-data">
			<div class="content clearfix upload_img">
				 <input type="file" class="up_file_s1" onchange="doingUploadImgNew();" id="upload_img_file" name="fileImage" />
		   </div>
		</form>

<script type="text/javascript">

	/* function closed(){
		$("#lb_pic").empty().hide();
	} */
	function doingUploadImgNew() {
		var filepath = $("#upload_img_file").val();
		//alert(filepath);
		var extStart = filepath.lastIndexOf(".");
		var ext = filepath.substring(extStart, filepath.length).toUpperCase();
		if (ext != ".PNG" && ext != ".JPG" && ext != ".JPEG" && ext != ".GIF") {
			alert("图片限于png,jpeg,jpg,gif格式");
			return;
		}
		$("#upload_img_form").ajaxSubmit({
			dataType : 'json',
			cache : false,
			success : function(data) {
				$("#lb_pic").empty().hide();
				addCommentPic(data);
			},
			error : function(err) {
				alert(err);
			}
		});
		return false;
	}
	function addCommentPic(data){
		if(commentImgList.size() < 1){
			var divHtml ='<li><div class="pic_box"><a href="javascript:;" onclick="delDoingImg(this)" class="close_pic"></a><img src="'+data.imageServer+data.thumbnail+'_468xXXX.jpg" class="block" id="rcommentPic"></div></li>';
			$("#comment_list").append(divHtml);
			commentImgList.add(data);
			$("#lb_pic").empty().hide();
		}else{
			alert("最多只能发一张图片");
			$("#lb_pic").empty().hide();
		}
		
	}
	</script>